package com.cuit.jifver.weibo.data;

import com.cuit.jifver.weibo.util.Constants;

/**
 * 获取配置文件
 * 
 * @author bywyu
 * 
 */
public class ConfigUtil
{
	
	private static ConfigUtil instance;
	
	// Activity之间传递值时的KEY
	public static final String OAUTH_VERIFIER_URL = "oauth_verifier_url";
	private String verifierName = "";  //URL返回授权码的变量名
	
	public String getVerifierName()
	{
		return verifierName;
	}

	public void setVerifierName(String verifierName)
	{
		this.verifierName = verifierName;
	}

	private String curWeibo = "";
	private String appKey = "";
	private String appSecret = "";
	
	private String server_url = "";
	private String request_token_url = "";
	private String authoriz_token_url = "";
	private String access_token_url = "";
	
	public static final String SINAW = "sina";
	public static final String QQW = "qq";
	public static final String SOHUW = "sohu";
	public static final String WANGYIW = "wangyi";
	
	public static String callBackUrl = "null";
	
	
	public static String access_token_name = Constants.sina.ACCESS_TOKEN;
	public static String access_token_secret_name = Constants.sina.ACCESS_TOKEN_SECRET;
	
	// --------------------qq
	private final String qq_AppKey = "1ca4fd07a7524e12bf8a124a6b8de52c";
	private final String qq_AppSecret = "7bd47ed82ebffbd4995f32c851bf6909";
	
//	private final String qq_AppKey = "801001096";
//	private final String qq_AppSecret = "31eceeb373c9758e01717459e3847603";
	
	public static String qq_server_url = "https://open.t.qq.com/";
	private final String qq_Request_token_url = "http://open.t.qq.com/cgi-bin/request_token";
//	private final String qq_Authoriz_token_url = "https://open.t.qq.com/cgi-bin/authorize";
	private final String qq_Authoriz_token_url = "http://open.t.qq.com/cgi-bin/authorize";
//	private final String qq_Access_token_url = "http://open.t.qq.com/cgi-bin/access_token";
	private final String qq_Access_token_url = "http://open.t.qq.com/cgi-bin/access_token";
	private final String qq_verifier_name = "v";
	
	// ---------------------sina
	// private final String sina_AppKey = "243378733";
	// private final String sina_AppSecret = "0ef6e24284db2a003ddde47c25c239d6";
	private final String sina_AppKey = "1108672235";
	private final String sina_AppSecret = "417466d2685f80420e60e8cec068fcec";
	
	public static String sina_server_url = "http://api.t.sina.com.cn/";
	private final String sina_Request_token_url = "http://api.t.sina.com.cn/oauth/request_token";
	private final String sina_Authoriz_token_url = "http://api.t.sina.com.cn/oauth/authorize";
	private final String sina_Access_token_url = "http://api.t.sina.com.cn/oauth/access_token";
	private final String sina_verifier_name = "oauth_verifier";
	
	// --------------------sohu
	// API Key btBPDWJxYfTt0cGUzazy
	private final String sohu_AppKey = "HEo10HnSYHyPW2vLACD1";
	private final String sohu_AppSecret = "WPO^1UJJ$riLp$=lNwvLvCSDHWV3PZcgrAGPqZNc";
	
	public static String sohu_server_url = "http://api.t.sohu.com/";
	private final String sohu_Request_token_url = "http://api.t.sohu.com/oauth/request_token";
	private final String sohu_Authoriz_token_url = "http://api.t.sohu.com/oauth/authorize";
	private final String sohu_Access_token_url = "http://api.t.sohu.com/oauth/access_token";
	private final String sohu_verifier_name = "oauth_verifier";
	
	// ---------------------wangyi
	private final String wangyi_AppKey = "GWFK3rY7TD0vaCm1";
	private final String wangyi_AppSecret = "tKmH59HBg1iVTfm27PrUEoprxuw1uw6c";
	
	public static String wangyi_server_url = "http://api.t.163.com/";
	private final String wangyi_Request_token_url = "http://api.t.163.com/oauth/request_token";
	private final String wangyi_Authoriz_token_url = "http://api.t.163.com/oauth/authenticate";
	private final String wangyi_Access_token_url = "http://api.t.163.com/oauth/access_token";
	private final String wangyi_verifier_name = "oauth_verifier";
	
	private Weibo mWeibo = Weibo.getInstance();
	
	public static synchronized ConfigUtil getInstance() {
		if (instance == null) {
			instance = new ConfigUtil();
		}
		return instance;
	}
	
	public ConfigUtil() {
		
	}
	
	/**
	 * 初始化QQ认证信息
	 */
	public void initQqData() {
		setAppKey(qq_AppKey);
		setAppSecret(qq_AppSecret);
		setServer_url(qq_server_url);
		setRequest_token_url(qq_Request_token_url);
		setAuthoriz_token_url(qq_Authoriz_token_url);
		setAccess_token_url(qq_Access_token_url);
		setVerifierName(qq_verifier_name);
		setAccess_token_name(Constants.qq.ACCESS_TOKEN);
		setAccess_token_secret_name(Constants.qq.ACCESS_TOKEN_SECRET);
		Weibo.getInstance().setMyWeibo(new QqWeibo());
		
	}
	
	/**
	 * 初始化SINA认证信息
	 */
	public void initSinaData() {
		setAppKey(sina_AppKey);
		setAppSecret(sina_AppSecret);
		setServer_url(sina_server_url);
		setRequest_token_url(sina_Request_token_url);
		setAuthoriz_token_url(sina_Authoriz_token_url);
		setAccess_token_url(sina_Access_token_url);
		setVerifierName(sina_verifier_name);
		setAccess_token_name(Constants.sina.ACCESS_TOKEN);
		setAccess_token_secret_name(Constants.sina.ACCESS_TOKEN_SECRET);
		Weibo.getInstance().setMyWeibo(new SinaWeibo());
	}
	
	/**
	 * 初始化SOHU认证信息
	 */
	public void initSohuData() {
		setAppKey(sohu_AppKey);
		setAppSecret(sohu_AppSecret);
		setServer_url(sohu_server_url);
		setRequest_token_url(sohu_Request_token_url);
		setAuthoriz_token_url(sohu_Authoriz_token_url);
		setAccess_token_url(sohu_Access_token_url);
		setVerifierName(sohu_verifier_name);
		setAccess_token_name(Constants.sohu.ACCESS_TOKEN);
		setAccess_token_secret_name(Constants.sohu.ACCESS_TOKEN_SECRET);
		Weibo.getInstance().setMyWeibo(new SohuWeibo());
	}
	
	/**
	 * 初始化网易认证信�?
	 */
	public void initWangyiData() {
		setAppKey(wangyi_AppKey);
		setAppSecret(wangyi_AppSecret);
		setServer_url(wangyi_server_url);
		setRequest_token_url(wangyi_Request_token_url);
		setAuthoriz_token_url(wangyi_Authoriz_token_url);
		setAccess_token_url(wangyi_Access_token_url);
		setVerifierName(wangyi_verifier_name);
		setAccess_token_name(Constants.wangyi.ACCESS_TOKEN);
		setAccess_token_secret_name(Constants.wangyi.ACCESS_TOKEN_SECRET);
		Weibo.getInstance().setMyWeibo(new WangyiWeibo());
	}
	
	public String getCurWeibo() {
		return curWeibo;
	}
	
	/**
	 * 设置当前操作的weibo 不同的weibo请求存在�?���?
	 * 
	 * @param curWeibo
	 */
	public void setCurWeibo(String curWeibo) {
		this.curWeibo = curWeibo;
	}
	
	public String getAppKey() {
		return appKey;
	}
	
	public void setAppKey(String appKey) {
		this.appKey = appKey;
	}
	
	public String getAppSecret() {
		return appSecret;
	}
	
	public void setAppSecret(String appSecret) {
		this.appSecret = appSecret;
	}
	
	public String getRequest_token_url() {
		return request_token_url;
	}
	
	public void setRequest_token_url(String requestTokenUrl) {
		request_token_url = requestTokenUrl;
	}
	
	public String getAuthoriz_token_url() {
		return authoriz_token_url;
	}
	
	public void setAuthoriz_token_url(String authorizTokenUrl) {
		authoriz_token_url = authorizTokenUrl;
	}
	
	public String getAccess_token_url() {
		return access_token_url;
	}
	
	public void setAccess_token_url(String accessTokenUrl) {
		access_token_url = accessTokenUrl;
	}
	
	public String getServer_url() {
		return server_url;
	}
	
	public void setServer_url(String serverUrl) {
		server_url = serverUrl;
	}

	public static String getAccess_token_name()
	{
		return access_token_name;
	}

	public static void setAccess_token_name(String access_token_name)
	{
		ConfigUtil.access_token_name = access_token_name;
	}

	public static String getAccess_token_secret_name()
	{
		return access_token_secret_name;
	}

	public static void setAccess_token_secret_name(String access_token_secret_name)
	{
		ConfigUtil.access_token_secret_name = access_token_secret_name;
	}
	
	
}
